package unit6;

public class StaticInnerClassTest {
	public static void main(String[] args) {
		double[] d=new double[20];
		for(int x=0;x<d.length;x++)
			d[x]=100*Math.random();
		ArrayAlg.Pair p=ArrayAlg.minMax(d);
		System.out.println("min"+p.getFirst());
		System.out.println("max"+p.getSecond());
	}
}
class ArrayAlg{
	public static class Pair{
		private double first;
		private double second;
		public Pair(double first, double second) {
			this.first = first;
			this.second = second;
		}
		public double getFirst() {
			return first;
		}
		public void setFirst(double first) {
			this.first = first;
		}
		public double getSecond() {
			return second;
		}
		public void setSecond(double second) {
			this.second = second;
		}
	}
	public static Pair minMax(double[] value){
		double min=Double.MIN_VALUE;
		double max=Double.MAX_VALUE;
		for(double v:value){
			if(min>v)
				min=v;
			if(max<v)
				max=v;
		}
		return new Pair(min, max);
	}
}
